<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>    
<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<title>发帖主页</title>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
    	<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="Casper" content="created by 2015?10?23? ??2:09:17">
		<meta name="keywords" content="write something you want">
		<meta name="description" content="write something you want">
		<link href="icon/favico.png" rel="icon">
		<link href="css/bootstrap.css" rel="stylesheet">
	</head>
	<body>
		     <nav class="navbar navbar-inverse navbar-fixed-top">
		      <div class="container">
		      <div class="navbar-header">
		         <a class="navbar-brand" href="">JavaWeb论坛</a>
		      </div>
		      <div id="navbar" class="navbar-collapse collapse">
		        <ul class="nav navbar-nav">
	        		<c:forEach items="${bmap }" var="map">
						<li class="dropdown">
	                 		<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">${map.key.boardName }<span class="caret"></span></a>
		               		<c:forEach items="${map.value }" var ="b">
		               			<ul class="dropdown-menu">
		                   			 <li><a href="#">${b.boardName }</a></li>
		                 		 </ul>
		               		</c:forEach>
	               		</li>
	        		</c:forEach>
		        </ul>
		          <div class="navbar-form navbar-right">
		            <div class="form-group">
						<c:choose>
							<c:when test="${empty user }">
								<button type="button" class="btn btn-success" data-toggle="modal" data-target="#userLoginModal">登录</button>
							</c:when>
							<c:otherwise>
								<button type="button" class="btn btn-success">${user.email }</button>	
							</c:otherwise>
						</c:choose>
		            </div>
		            	<c:choose>
		            		<c:when test="${empty user }">
		            			<a class="btn btn-success" href="user-register.jsp">注册</a>			
		            		</c:when>
		            		<c:otherwise>
		            			<a class="btn btn-success" href="#">注销</a>
		            		</c:otherwise>
		            	</c:choose>
		          </div>
		      </div>
		   </div>
		 </nav>
		 <div class="container" style="margin-top:60px; ">
			<a href="user-article.jsp" class="btn btn-success">发帖</a> 
		 </div>
		 
		
		   
		
		
		
		<!-- 用户登录 Modal -->
		<div class="modal fade" id="userLoginModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		  <div class="modal-dialog" role="document">
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		        <h4 class="modal-title" id="myModalLabel">用户登录</h4>
		      </div>
		      <div class="modal-body">
		      			<form action="UserServlet?op=userLogin" method="post" name="userLoginForm">
						  <div class="form-group">
						    <label for="exampleInputEmail1" >邮箱</label>
						    <input type="email" class="form-control" name="email" id="exampleInputEmail1" placeholder="Email">
						  </div>
						  <div class="form-group">
						    <label for="exampleInputPassword1">Password</label>
						    <input type="password" class="form-control" name="pass" id="exampleInputPassword1" placeholder="Password">
						  </div>
						  <div class="checkbox">
						    <label>
						      <input type="checkbox"> 记住密码
						    </label>
						  </div>
					</form>
		      </div>
		      <div class="modal-footer">
		        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
		        <button type="button" class="btn btn-primary" onclick="submitUserLogin()">登录</button>
		      </div>
		    </div>
		  </div>
		</div>	

		<script type="text/javascript">
			function submitUserLogin(){
				document.userLoginForm.submit();
			}
		</script>
		<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
		<script type="text/javascript" src="js/bootstrap.min.js"></script>
	</body>
</html>